<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //快慢指针法  不一样的交换位置nums[slow+1]=fast 快指针一直走  慢指针不想等再走
    function fn(nums) {
        let slow = 0
        let fast = 1
        while (fast < nums.length) {
            if (nums[slow] !== nums[fast]) {
                slow += 1
                nums[slow] = nums[fast]
            }
            fast++
        }

        console.log(nums, ":----");
    }
    let arr = [1, 2, 2, 3, 4, 55, 6, 6, 7]
    fn(arr)
</script>

</html>